package ru.ccfit.nsu.g7204.dronov.adPlatform.command;

import ru.ccfit.nsu.g7204.dronov.adPlatform.client.ClientCallDTO;
import ru.ccfit.nsu.g7204.dronov.adPlatform.client.ClientMessageParser;
import ru.ccfit.nsu.g7204.dronov.adPlatform.client.ShowNumbers;
import ru.ccfit.nsu.g7204.dronov.adPlatform.system.network.NetworkInterfaceTask;
import ru.nsu.ccfit.g7204.dronov.DI.Locator;

import java.nio.channels.SocketChannel;

/**
 * @author vdronov
 */
public class CallAcceptingTask extends NetworkInterfaceTask {

    public CallAcceptingTask(SocketChannel channel) {
        super(channel);
    }



    @Override
    public String processMessage(String msg) {
        ClientMessageParser messageParser = Locator.INSTANCE.get(ClientMessageParser.class);
        ClientCallDTO callDTO = messageParser.parseMessage(msg);
        if (callDTO==null){
            return null;
        }
        if (ShowNumbers.contains(msg)){
           return showAd(callDTO);
        }
        return acceptClick(callDTO);
    }

    private String showAd(ClientCallDTO callDTO) {

        return null;  //To change body of created methods use File | Settings | File Templates.
    }

    private String acceptClick(ClientCallDTO callDTO) {
        return null;  //To change body of created methods use File | Settings | File Templates.
    }

}
